﻿package frEngine.loaders.resource.info
{
    import flash.utils.*;
    import frEngine.*;
    import frEngine.core.*;
    import frEngine.event.*;
    import frEngine.loaders.away3dMd5.*;

    public class Md5MeshInfo extends Info3dBase
    {
        public var materialName:String;
        public var defaultMaterial:String;
        public var vertexNum:uint;
        public var faceNum:uint;
        private var _surf:FrSurface3D;
        private var _skeleton:Skeleton;
        public var userList:Dictionary;

        public function Md5MeshInfo(param1:Object)
        {
            this.userList = new Dictionary(false);
            super(param1);
            return;
        }// end function

        public function get surface3d() : FrSurface3D
        {
            return this._surf;
        }// end function

        public function get skeleton() : Skeleton
        {
            return this._skeleton;
        }// end function

        override public function dispose() : void
        {
            var _loc_1:Object = null;
            for each (_loc_1 in this.userList)
            {
                
                return;
            }
            if (this._surf)
            {
                this._surf.clear();
            }
            if (this._skeleton)
            {
                this._skeleton.dispose();
            }
            super.dispose();
            return;
        }// end function

        override public function set data(param1:Object) : void
        {
            super.data = param1;
            if (!this._surf)
            {
                this._surf = new FrSurface3D("");
                this._surf.targetInfo = this;
            }
            else
            {
                this._surf.clear();
            }
            var _loc_2:* = new MD5MeshByteArrayParser(this.name);
            if (!this._skeleton)
            {
                this._skeleton = new Skeleton(this);
            }
            else
            {
                this._skeleton.dispose();
            }
            _loc_2.proceedParsing(_byteArray, this._surf, this._skeleton);
            this._skeleton.meshUrl = this.name;
            return;
        }// end function

        override public function proceedParsing() : void
        {
            if (proceedParsed || !_byteArray)
            {
                return;
            }
            proceedParsed = true;
            FrEventDispatcher.instance.proxyDispatchEvent(this, Engine3dEventName.PARSE_RESOURCE_FINISH);
            return;
        }// end function

    }
}
